<?php
/**
 * Created by PhpStorm.
 * User: u
 * Date: 2018/12/11
 * Time: 15:38
 */
namespace common\sources\write\shop;

use Yii;
class ShopAccess implements IShopAccess
{
    public function addShop($data)
    {

        $insert = 'INSERT INTO shop (bus_id,cate_id,cate_name,good_type_id,good_type_name,home_url,ww_name,shop_name,good_url,send_name,send_phone,pro_name,pro_code,city_name,city_code,
                    area_name,area_code,addr,create_time,shop_type,audit_status)
                   VALUES (:bus_id,:cate_id,:cate_name,:good_type_id,:good_type_name,:home_url,:ww_name,:shop_name,:good_url,:send_name,:send_phone,:pro_name,:pro_code,:city_name,:city_code,
                    :area_name,:area_code,:addr,:create_time,:shop_type,:audit_status)';
        return Yii::$app->db->createCommand($insert )->bindValues([
            ':bus_id' => $data['bus_id'],
            ':cate_id'=>$data['cate_id'],
            ':cate_name'=>$data['cate_name'],
            ':good_type_id'=>$data['good_type_id'],
            ':good_type_name'=>$data['good_type_name'],
            ':home_url'=>$data['home_url'],
            ':ww_name'=>$data['ww_name'],
            ':shop_name'=>$data['shop_name'],
            ':good_url'=>$data['good_url'],
            ':send_name'=>$data['send_name'],
            ':send_phone'=>$data['send_phone'],
            ':pro_name'=>$data['pro_name'],
            ':pro_code'=>$data['pro_code'],
            ':city_name'=>$data['city_name'],
            ':city_code'=>$data['city_code'],
            ':area_name'=>$data['area_name'],
            ':area_code'=>$data['area_code'],
            ':addr' => $data['addr'],
            ':create_time'=> time(),
            ':shop_type'=>$data['shop_type'],
            ':audit_status'=> 1,
        ])->execute();
    }
}